﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using System.Text;
using System.IO;
using System.Xml;
using BLL;
using DAL;
using Models;
using System.Data;
using Web.Old_App_Code;


public partial class alipay_return_url : System.Web.UI.Page
{
    // Fields

    // Methods
    public SortedDictionary<string, string> GetRequestGet()
    {
        int index = 0;
        SortedDictionary<string, string> dictionary = new SortedDictionary<string, string>();
        string[] allKeys = base.Request.QueryString.AllKeys;
        for (index = 0; index < allKeys.Length; index++)
        {
            dictionary.Add(allKeys[index], base.Request.QueryString[allKeys[index]]);
        }
        return dictionary;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        SortedDictionary<string, string> requestGet = this.GetRequestGet();
        AlipayConfig config = new AlipayConfig();
        string partner = config.Partner;
        string key = config.Key;
        string str3 = config.Input_charset;
        string str4 = config.Sign_type;
        string transport = config.Transport;
        if (requestGet.Count > 0)
        {
            AlipayNotify notify = new AlipayNotify(requestGet, base.Request.QueryString["notify_id"], partner, key, str3, str4, transport);
            string responseTxt = notify.ResponseTxt;
            string str7 = base.Request.QueryString["sign"];
            string mysign = notify.Mysign;
            if ((responseTxt == "true") && (str7 == mysign))
            {
                string str9 = base.Request.QueryString["trade_no"];
                string str10 = base.Request.QueryString["out_trade_no"];
                string str11 = base.Request.QueryString["total_fee"];
                string str12 = base.Request.QueryString["subject"];
                string str13 = base.Request.QueryString["body"];
                string str14 = base.Request.QueryString["buyer_email"];
                string str15 = base.Request.QueryString["trade_status"];
                this.lbTrade_no.Text = str9;
                this.lbOut_trade_no.Text = str10;
                this.lbTotal_fee.Text = str11;
                this.lbSubject.Text = str12;
                this.lbBody.Text = str13;
                this.lbBuyer_email.Text = str14;
                this.lbTrade_status.Text = str15;
                this.lbVerify.Text = "验证成功";
                if ((base.Request.QueryString["trade_status"] != "TRADE_FINISHED") && !(base.Request.QueryString["trade_status"] == "TRADE_SUCCESS"))
                {
                    base.Response.Write("trade_status=" + base.Request.QueryString["trade_status"]);
                }
            }
            else
            {
                this.lbVerify.Text = "验证失败";
            }
        }
        else
        {
            this.lbVerify.Text = "无返回参数";
        }
    }

}